package com.hysf.project1;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Primary;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Primary
public class PersonMysqlDao implements PersonDao {
	@Autowired
	@Qualifier ("jdbcTemplate")
	private JdbcTemplate jdbcTemplate;
	
	@Override
	public List<Person> findAll() {
		String sql = "SELECT * FROM person";
		return jdbcTemplate.query(sql, new MyMapper());
	}
}
